package com.yixun.qfbao.hander;/**
 * @program: channel-parent
 * @description:
 * @author: Seven.wang
 * @create: 2020-07-14 15:49
 **/

import com.yixun.qfbao.apidto.InitDataResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.service.ReportCommissionService;
import com.yixun.qfbao.vo.InitReportCommissionDataReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @program: channel-parent
 *
 * @description:
 *
 * @author: Seven.wang
 *
 * @create: 2020-07-14 15:49
 **/
@Service("initReportCommissionDataHander")
public class InitReportCommissionDataHander extends CommonAbstractHander {

    private Logger logger = LoggerFactory.getLogger(InitReportCommissionDataHander.class);

    @Autowired
    private ReportCommissionService reportCommissionService;

    @Override
    public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
        InitReportCommissionDataReqVo req = (InitReportCommissionDataReqVo)reqDto;
        String reqDto1 = req.getParams();
        BaseResponseDTO<InitDataResDto> res = new BaseResponseDTO<InitDataResDto>();
        InitDataResDto resDto = new InitDataResDto();
        try {
            reportCommissionService.initDevCompanyId();
            resDto.setResult(ResultEnum.SUCCESS.getNo());
            resDto.setResultMsg(ResultEnum.SUCCESS.getDes());
        }catch (Exception e){
            resDto.setResult(ResultEnum.FAIL.getNo());
            resDto.setResultMsg(ResultEnum.FAIL.getDes());
            logger.error("InitReportCommissionDataHander error info: {}", e);
        }
        res.setResData(resDto);
        res.setResult(resDto.getResult());
        return res;
    }
}
